{# What Rows and Query share: the note saying why the app's data is hidden (``exposure.refusal``), and rows read like Logs (``rows_scroller``): one line each, cut at the edge like a log line, a click opening one, a column holding a secret shown as hidden. ``found`` is a page (db_rows.Rows) or an answer (db_query.Answer); ``body`` the tbody's id, for Top and Bottom; ``key`` the column the pages run on; ``links``, a row's keys (overseer_database_browser.row_links), opening under it with it, each opening that table (``#database-table``); ``sorts``, the columns the server orders the whole table by (overseer_database_browser.rows), each header a link, every other header sorting the rows shown (rows.js), which ``export_menu`` exports. #} {% from "components/macros/icons.html" import icon %} {% from "components/macros/layout.html" import dropdown, menu_heading, menu_item %} {% from "pages/overseer/_macros.html" import opens_rows %} {% macro rows_off_note(reason) %}

A table's rows are the app's data: {{ reason }}

{%- endmacro %} {% macro export_menu(body, name) %} {% set label %}{{ icon("arrow-up-tray", "w-3.5 h-3.5") }}Export{% endset %} {% call dropdown(label) %} {% set formats = {"csv": ("CSV", "document-text"), "json": ("JSON", "code-bracket"), "tsv": ("For a sheet", "table-cells"), "markdown": ("Markdown table", "hashtag")} %} {% for to, heading, glyph, picks in (("file", "Download", "arrow-down-tray", ("csv", "json")), ("copy", "Copy", "copy", ("tsv", "csv", "json", "markdown"))) %} {{ menu_heading(heading, glyph) }} {% for format in picks %} {% set attrs %}data-export="{{ format }}" data-export-to="{{ to }}" data-export-rows="#{{ body }}" data-export-name="{{ name }}"{% endset %} {% set item %}{{ icon(formats[format][1], "w-3.5 h-3.5 text-aegis-muted") }}{{ formats[format][0] }}{% endset %} {{ menu_item(item, attrs) }} {% endfor %} {% endfor %} {% endcall %} {%- endmacro %} {% macro rows_table(found, body, key=None, empty="No rows.", links=None, sorts=None) %} {% set arrows %}{{ icon("arrow-up", "rows-sort-up w-3 h-3", 2) }}{{ icon("arrow-down", "rows-sort-down w-3 h-3", 2) }}{% endset %} {% for column in found.columns %}{% set order = sorts.get(column) if sorts else none %}{% endfor %} {% for row in found.rows %} {% for cell in row %}{% set column = found.columns[loop.index0] %}{% endfor %} {% if links and links[loop.index0] %} {% endif %} {% endfor %}
{% if order %}{{ column }}{{ arrows }}{% else %}{% endif %}{% if column == key %}⌗{% endif %}
{{ cell }}
{% for link in links[loop.index0] %}{{ link.label }}{% endfor %}
{% if not found.rows %}

{{ empty }}

{% endif %} {%- endmacro %}